package pers.zc.activiti.shujujiegou.zhan;

/**
 * @Annotion: 栈结构
 * @ClassName: Stack
 * @Author: Lin Fuyuan
 * @Date: 2019/11/20  15:54
 * @Version: 1.0
 */
public class Stack {

    private Integer[] stack;
    private int count;

    Stack(int n){
        this.stack = new Integer[n];
        this.count = 0;
    }

    public Integer getStack() {
        if(count ==0){
            return null;
        }
        int  y = this.stack[count-1];
        this.count --;
        return y;
    }

    public boolean setStack(int k) {
        this.stack[count] = k;
        this.count++;
        if(count>stack.length){
            return false;
        }
        return true;
    }
}
